package com.njitweb.controller;

import com.njitweb.service.FileService;
import com.njitweb.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;
@RestController
@RequestMapping("/file")
public class FileController {

    @Autowired
    private FileService fileService;

    @PostMapping("/upload")
    public Result uploadFileV1(MultipartFile file) {
        Map<String, Object> map = fileService.upload(file);
        return Result.success(map);
    }
}
